local deshi = fk.CreateSkill {
  name = "tyj_heg__deshi",
  tags = { Skill.Compulsory },
}
local H = require "packages.ol_hegemony.util"
local U = require "packages.utility.utility"
Fk:loadTranslationTable {
  ["tyj_heg__deshi"] = "德释",
  [":tyj_heg__deshi"] = "锁定技，你受到【杀】造成的伤害时，若你有国战标记，你防止之并移去一枚国战标记。",
  ["$tyj_heg__deshi1"] = "你我素无仇怨，何故欺之太急。",
  ["$tyj_heg__deshi2"] = "恃强凌弱，非大丈夫之所为。",
  ["~tyj_heg__hujinding"] = "臣辅孙氏三代之业，今年近古稀，死而无憾。",
}
deshi:addEffect(fk.DamageInflicted, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    if player == target and player:hasSkill(deshi.name) then
      if player:getMark("@!!yinyangfish") == 0 and player:getMark("@!!companion") == 0
          and player:getMark("@!!wild") == 0 and player:getMark("@!!vanguard") == 0 then
        return false
      end
      return data.card and data.card.trueName and data.card.trueName == "slash"
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local choices = {}
    if player:getMark("@!!yinyangfish") > 0 then
      table.insert(choices, "@!!yinyangfish")
    end
    if player:getMark("@!!companion") > 0 then
      table.insert(choices, "@!!companion")
    end
    if player:getMark("@!!vanguard") > 0 then
      table.insert(choices, "@!!vanguard")
    end
    if player:getMark("@!!wild") > 0 then
      table.insert(choices, "@!!wild")
    end
    if #choices > 0 then
      local choice = room:askToChoice(player, {
        choices = choices,
        prompt = "德释：请移去一个国战标记",
        skill_name = deshi.name
      })

      H.removeHegMark(room, player, string.sub(choice, 4, choice:len()))
      data:preventDamage()
    end
  end,
})
return deshi
